//
//  CJCRCTool.swift
//  CJPack
//
//  Created by 陈警卫 on 2025/7/10.
//

import Foundation

public class CJCRCTool {
    
    /// 字节位翻转
    public static func reverseBits<T: FixedWidthInteger>(_ value: T) -> T {
        var input = value
        var output: T = 0
        
        for _ in 0..<T.bitWidth {
            output = (output << 1) | (input & 1)
            input >>= 1
        }
        
        return output
    }
}

